// TOWN SCRIPT
//    Town 6: Asner

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documenation. States you write
// yourself should be numbered from 10-100.

// flags:
// 6, 2 = asked Jennie her name
// 6, 3 = healing herb bush
// 6, 4 = spiritual herb bush
// 6, 5 = energetic herb bush

begintownscript;

variables;

short i, choice;

body;

beginstate INIT_STATE;
	set_crime_tolerance(5);

	set_name(6, "Carrie");
	set_char_dialogue_pic(6, 526, 0);
	set_name(7, "Wanda");
	set_char_dialogue_pic(7, 540, 0);
	set_name(8, "Jennie");
	set_char_dialogue_pic(8, 534, 0);
	set_name(10, "Father Ian");
	set_char_dialogue_pic(10, 543, 0);

	// reset temple sign flag
	set_flag(6, 0, 0);
break;

beginstate EXIT_STATE;
// Always called when the town is left.
break;

beginstate START_STATE;
	if (get_ran(1, 0, 100) < 6) {
		text_bubble_on_char(9, "Stay out of trouble.");
	}
	if (get_ran(1, 0, 100) < 6) {
		text_bubble_on_char(10, "Bless you.");
	}
break;

beginstate 10;
	if (get_flag(6, 0) == 0) {
		set_flag(6, 0, 1);
		i = 0;
		reset_dialog();
		if (get_flag(6, 1) == 0) {
			set_flag(6, 1, 1);
			add_dialog_str(0, "The temple is quiet and peaceful.", 0);
			add_dialog_str(1, "Seems to be a big graveyard for the size of the village though.", 0);
			i = 2;
		}
		add_dialog_str(i, "A sign on the wall says:", 0);
		i = i + 1;
		if (char_ok(10))
			add_dialog_str(i, "The priest is *IN*", 10);
		else
			add_dialog_str(i, "The priest is *OUT*", 10);
		add_dialog_choice(0, "OK");
		choice = run_dialog(0);
	}
break;
